package com.HospitalOutpatient.controller;

import com.HospitalOutpatient.entity.User;

import javax.xml.bind.ValidationException;

public class UserContext {
    private static final ThreadLocal<User> USER_CONTEXT = ThreadLocal.withInitial(User::new);

    public static void set(User user) {
        if (user != null) {
            USER_CONTEXT.set(user);
        }
    }

    public static User get() {
        return USER_CONTEXT.get();
    }

    public static void remove() {
        USER_CONTEXT.remove();
    }

}
